package finance

import grails.test.*

class ShuffleServiceTests extends GrailsUnitTestCase {
    protected void setUp() {
        super.setUp()
    }

    protected void tearDown() {
        super.tearDown()
    }

    def shuffleService
    
    void testPeriods() {
        def sinus = []
        
        for(i in 0..2600) {
            sinus << 7 + Math.sin( Math.PI/6 + 2 * Math.PI * i / 23) - Math.cos( Math.PI/4 + 2 * Math.PI * i / 42 ) + Math.sin( 2 * Math.PI * i / 7 )
        }
        
        def top6 = shuffleService.periods(sinus)
        assertTrue(top6.contains(23) && top6.contains(42) && top6.contains(7))
    }
}
